// 粒子背景模块
$(function() {
    $('#particles').particleground({
        dotColor: '#7ec7fc',
        lineColor: '#1ec7fd',

        density: 8000,
        // Dotsize: 10,
        // curvedLines: true, // 是否弯曲
        parallaxMultiplier: 5
    })
})

// 登录功能
var form = layui.form
var layer = layui.layer

$('#layui-form').submit(function(e) {
    e.preventDefault()
    var data = form.val('layui-form')
    $.ajax({
        type: 'post',
        data: data,
        url: '/api/login',
        success: function(res) {
            if (res.status !== 0) {
                return layer.msg('登录失败')
            }
            layer.msg('登录成功', function() {
                localStorage.setItem('token', res.token)
                location.href = '/index.html'
            })
        }
    })
})